package com.friend.controller.question;

import com.common.core.domain.Result;
import com.common.core.domain.TableDataInfo;
import com.friend.domain.question.dto.QuestionQueryDTO;
import com.friend.domain.question.vo.QuestionDetailVO;
import com.friend.service.question.QuestionService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/question")
@Tag(name = "题目管理API")
public class QuestionController {

    @Resource
    QuestionService questionService;

    /**
     *获取题目列表
     *
     */
    @GetMapping("/semiLogin/list")
    public TableDataInfo list(QuestionQueryDTO questionQueryDTO){
        return questionService.list(questionQueryDTO);
    }

    /**
     * 获取题目详情
     *
     */
    @GetMapping("/detail")
    public Result<QuestionDetailVO> detail(Long questionId){
        return Result.success(questionService.detail(questionId));
    }

    /**
     * 获取上一个题目
     *
     */
    @GetMapping("/preQuestion")
    public Result<String> preQuestion(Long questionId){
        return Result.success(questionService.preQuestion(questionId));
    }

    /**
     * 获取下一个题目
     *
     */
    @GetMapping("/nextQuestion")
    public Result<String> nextQuestion(Long questionId){
        return Result.success(questionService.nextQuestion(questionId));
    }
}
